import re
import requests
from urllib3.exceptions import InsecureRequestWarning

# 禁用安全请求警告

Platform = "掌都1_定制小说"


def zhangdu1():
    try:
        requests.urllib3.disable_warnings(InsecureRequestWarning)
        r = requests.session()
        url = "https://novel.zhangdu520.com/default/login"
        date = {
            "username": "",
            "password": "",
            "act": "login"
        }
        rr = r.post(url=url, data=date, verify=False, timeout=15)
        aa = r.get(url="https://novel.zhangdu520.com/pay/income", verify=False, timeout=15)
        html = aa.text.replace('\r', '').replace('\n', '').replace('\t', '')
        date_time = re.findall('<tbody>.*?<td>(.*?)</td>', html)[0]
        Amount_share = re.findall('<tbody>.*?<td>90%.*?<td>¥(.*?)</td>', html)[0].replace(',', '')
        return date_time, Amount_share, Platform
    except Exception:
        print("获取 掌都1_定制小说 数据失败")
        return '', 'None', Platform
    except ConnectionError:
        print("获取 掌都1_定制小说 数据 超时")
        return '', 'None', Platform
